<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>SoupContentSniffer</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="libsoup Reference Manual">
<link rel="up" href="ch03.html" title="Additional Features">
<link rel="prev" href="SoupContentDecoder.html" title="SoupContentDecoder">
<link rel="next" href="SoupCookieJar.html" title="SoupCookieJar">
<meta name="generator" content="GTK-Doc V1.18 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="SoupContentDecoder.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="ch03.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">libsoup Reference Manual</th>
<td><a accesskey="n" href="SoupCookieJar.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#SoupContentSniffer.synopsis" class="shortcut">Top</a>
                   | 
                  <a href="#SoupContentSniffer.description" class="shortcut">Description</a>
                   | 
                  <a href="#SoupContentSniffer.object-hierarchy" class="shortcut">Object Hierarchy</a>
                   | 
                  <a href="#SoupContentSniffer.implemented-interfaces" class="shortcut">Implemented Interfaces</a>
</td></tr>
</table>
<div class="refentry">
<a name="SoupContentSniffer"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="SoupContentSniffer.top_of_page"></a>SoupContentSniffer</span></h2>
<p>SoupContentSniffer — Content sniffing for <a class="link" href="SoupSession.html" title="SoupSession"><span class="type">SoupSession</span></a></p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="SoupContentSniffer.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
#include &lt;libsoup/soup.h&gt;

                    <a class="link" href="SoupContentSniffer.html#SoupContentSniffer-struct" title="SoupContentSniffer">SoupContentSniffer</a>;
<a class="link" href="SoupContentSniffer.html" title="SoupContentSniffer"><span class="returnvalue">SoupContentSniffer</span></a> * <a class="link" href="SoupContentSniffer.html#soup-content-sniffer-new" title="soup_content_sniffer_new ()">soup_content_sniffer_new</a>           (<em class="parameter"><code><span class="type">void</span></code></em>);
<span class="returnvalue">char</span> *              <a class="link" href="SoupContentSniffer.html#soup-content-sniffer-sniff" title="soup_content_sniffer_sniff ()">soup_content_sniffer_sniff</a>          (<em class="parameter"><code><a class="link" href="SoupContentSniffer.html" title="SoupContentSniffer"><span class="type">SoupContentSniffer</span></a> *sniffer</code></em>,
                                                         <em class="parameter"><code><a class="link" href="SoupMessage.html" title="SoupMessage"><span class="type">SoupMessage</span></a> *msg</code></em>,
                                                         <em class="parameter"><code><a class="link" href="SoupMessageBody.html#SoupBuffer"><span class="type">SoupBuffer</span></a> *buffer</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a> **params</code></em>);
</pre>
</div>
<div class="refsect1">
<a name="SoupContentSniffer.object-hierarchy"></a><h2>Object Hierarchy</h2>
<pre class="synopsis">
  <a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#GObject">GObject</a>
   +----SoupContentSniffer
</pre>
</div>
<div class="refsect1">
<a name="SoupContentSniffer.implemented-interfaces"></a><h2>Implemented Interfaces</h2>
<p>
SoupContentSniffer implements
 <a class="link" href="SoupSessionFeature.html" title="SoupSessionFeature">SoupSessionFeature</a>.</p>
</div>
<div class="refsect1">
<a name="SoupContentSniffer.description"></a><h2>Description</h2>
<p>
A <a class="link" href="SoupContentSniffer.html" title="SoupContentSniffer"><span class="type">SoupContentSniffer</span></a> tries to detect the actual content type of
the files that are being downloaded by looking at some of the data
before the <a class="link" href="SoupMessage.html" title="SoupMessage"><span class="type">SoupMessage</span></a> emits its <a class="link" href="SoupMessage.html#SoupMessage-got-headers" title='The "got-headers" signal'><span class="type">"got-headers"</span></a> signal.
<a class="link" href="SoupContentSniffer.html" title="SoupContentSniffer"><span class="type">SoupContentSniffer</span></a> implements <a class="link" href="SoupSessionFeature.html" title="SoupSessionFeature"><span class="type">SoupSessionFeature</span></a>, so you can add
content sniffing to a session with <a class="link" href="SoupSession.html#soup-session-add-feature" title="soup_session_add_feature ()"><code class="function">soup_session_add_feature()</code></a> or
<a class="link" href="SoupSession.html#soup-session-add-feature-by-type" title="soup_session_add_feature_by_type ()"><code class="function">soup_session_add_feature_by_type()</code></a>.
</p>
</div>
<div class="refsect1">
<a name="SoupContentSniffer.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="SoupContentSniffer-struct"></a><h3>SoupContentSniffer</h3>
<pre class="programlisting">typedef struct _SoupContentSniffer SoupContentSniffer;</pre>
<p>
</p>
</div>
<hr>
<div class="refsect2">
<a name="soup-content-sniffer-new"></a><h3>soup_content_sniffer_new ()</h3>
<pre class="programlisting"><a class="link" href="SoupContentSniffer.html" title="SoupContentSniffer"><span class="returnvalue">SoupContentSniffer</span></a> * soup_content_sniffer_new           (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>
Creates a new <a class="link" href="SoupContentSniffer.html" title="SoupContentSniffer"><span class="type">SoupContentSniffer</span></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a new <a class="link" href="SoupContentSniffer.html" title="SoupContentSniffer"><span class="type">SoupContentSniffer</span></a>
</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.27.3</p>
</div>
<hr>
<div class="refsect2">
<a name="soup-content-sniffer-sniff"></a><h3>soup_content_sniffer_sniff ()</h3>
<pre class="programlisting"><span class="returnvalue">char</span> *              soup_content_sniffer_sniff          (<em class="parameter"><code><a class="link" href="SoupContentSniffer.html" title="SoupContentSniffer"><span class="type">SoupContentSniffer</span></a> *sniffer</code></em>,
                                                         <em class="parameter"><code><a class="link" href="SoupMessage.html" title="SoupMessage"><span class="type">SoupMessage</span></a> *msg</code></em>,
                                                         <em class="parameter"><code><a class="link" href="SoupMessageBody.html#SoupBuffer"><span class="type">SoupBuffer</span></a> *buffer</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a> **params</code></em>);</pre>
<p>
Sniffs <em class="parameter"><code>buffer</code></em> to determine its Content-Type. The result may also
be influenced by the Content-Type declared in <em class="parameter"><code>msg</code></em>'s response
headers.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>sniffer</code></em> :</span></p></td>
<td>a <a class="link" href="SoupContentSniffer.html" title="SoupContentSniffer"><span class="type">SoupContentSniffer</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>msg</code></em> :</span></p></td>
<td>the message to sniff</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>buffer</code></em> :</span></p></td>
<td>a buffer containing the start of <em class="parameter"><code>msg</code></em>'s response body</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>params</code></em> :</span></p></td>
<td>return
location for Content-Type parameters (eg, "charset"), or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> utf8 utf8][<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>][<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the sniffed Content-Type of <em class="parameter"><code>buffer</code></em>; this will never be <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>,
but may be "application/octet-stream".</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.18</div>
</body>
</html>